import Vue from 'vue'
import VueRouter from 'vue-router'
// import Login from '@/views/login'
// import Register from '@/views/register'
// import NotFound from '@/views/NotFound'

// import Home from '@/views/home'
// import User from '@/views/user'
// import News from '@/views/news'
// import GetHouse from '@/views/getHouse'
// import Layout from '@/views/layout'
const Layout = () => import('@/views/layout')
const Login = () => import('@/views/login')
const Register = () => import('@/views/register')
const NotFound = () => import('@/views/NotFound')
const Home = () => import('@/views/home')
const User = () => import('@/views/user')
const News = () => import('@/views/news')
const GetHouse = () => import('@/views/getHouse')
const Collect = () => import('@/views/collect')
const Taxi = () => import('@/views/taxi')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/home'
  },
  {
    path: '*',
    component: NotFound
  },
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/taxi',
    component: Taxi
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      { path: 'home', component: Home },
      { path: 'user', component: User },
      { path: 'news', component: News },
      { path: 'getHouse', component: GetHouse }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
